<?php

/**
 * *******************************************************************************
 * ImportedFiles Interface - Action 06
 * Generate HTML Form regarding DocType and attributes definition
 * *******************************************************************************
 * @author $Author: damien.viguier@gmail.com $
 * @version $Rev: 22 $
 * @internal $Id: ajx-ui-ImportedFiles-a06.php 22 2013-08-18 11:28:48Z damien.viguier@gmail.com $
 * @internal $LastChangedDate: 2013-08-18 11:28:48 +0000 (Sun, 18 Aug 2013) $
 * @link $HeadURL: http://personal-ged.googlecode.com/svn/trunk/webroot/ajax/data/ajx-ui-ImportedFiles/ajx-ui-ImportedFiles-a06.php $
 * *******************************************************************************
 */

include_once './../class/DocTypes.class.php';
include_once './../../../lib/AttributesDefManagement.class.php';
error_reporting(E_ERROR);

/* ************************************* */

if(array_key_exists('DocTypeID', $_REQUEST))
{
	$l_s_id = $_REQUEST['DocTypeID'];
	$l_as_results = DocTypes::getAllAttributesDefByDocTypeID($l_s_id);

	if(count($l_as_results)==0)
	{
		$l_s_results["noresults"] = true;
	}
	else
	{
		$l_s_results["html"] = AttributesDefManagement::transformAttrDefArrayToHTMLForm($l_as_results);
		$l_s_results["dataAttr"] = $l_as_results;
	}
}
else
{
	$l_s_results["err"] = "No document type identified.";
	$l_s_results["noresults"] = true;
}
echo json_encode($l_s_results);

?>